<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../00.依赖包/react.development.js"></script>
  <script src="../00.依赖包/react-dom.development.js"></script>
  <script src="../00.依赖包/babel.min.js"></script>
  <script src="../00.依赖包/prop-types.js"></script>
</head>

<body>
  <div id="app"></div>
  <script type="text/babel">
    /* 
      字符串形式的Refs:
        - 给被获取的元素添加一个ref属性,值是字符串(随意命名)
        - 在组件实例上就会有一个ref对象,对象中有一个你设置的字符串属性,值是他代表的DOM
    
    */
    class Parent extends React.Component{
      render(){
        return (
          <div>
            <input type="text" ref="oIpt"/>
            <button onClick={this.handle}>点我弹出用户的输入内容</button>
          </div>
        )
      }

      handle = () => {
        // console.log(this);
        const {value} = this.refs.oIpt;
        alert(value)
      }
    }

    

    const root = ReactDOM.createRoot(document.getElementById('app'));
    root.render(<Parent/>)




  </script>
</body>

</html>